package org.pageley.games.sanctuary.domain;

import java.util.Random;

public class Dice {
	public static Die ONE = new Die();
	
	public static class Die {
		private Die() { }
				
		public double chanceOfAtLeast(int requiredRoll) {
			double chance = 0.0;
			if(requiredRoll < 1) {
				chance = 1.0;
			} else if(requiredRoll >= 1 && requiredRoll <= 6) {
				chance = (double) (7 - requiredRoll) / 6; 
			}
			return chance;
		}
		
		public int roll() {
			return new Random().nextInt(5) + 1;
		}
		
		public boolean rollAtLeast(int requiredRoll) {
			return roll() >= requiredRoll;
		}
	}
}
